package com.hsmw.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hsmw.common.base.BaseModel;
import com.hsmw.common.context.SecurityConstants;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 用户表
 * </p>
 *
 * @author 田佳宇
 * @since 2020-12-16
 */
@NoArgsConstructor
@ToString
@AllArgsConstructor
@Builder
@TableName("hsmw_user")
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "HsmwUser对象", description = "用户表")
public class HsmwUser extends BaseModel {

	private static final long serialVersionUID = 1L;


	@ApiModelProperty(value = "登陆账号")
	private String username;

	@ApiModelProperty(value = "加密后密码")
	private String password;

	@ApiModelProperty(value = "登陆人名称")
	private String name;

	@ApiModelProperty(value = "该用户所属的终端类型")
	private String type;

	@ApiModelProperty(value = "角色id")
	private String roleId;

	@ApiModelProperty(value = "角色名称")
	@TableField(exist = false)
	private String roleName;


	@ApiModelProperty(value = "1:启用,0:禁用")
	private Boolean enabled;

	@ApiModelProperty(value = "逻辑删除标记 ")
	private boolean flag;

	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ApiModelProperty(value = "最后登陆时间")
	private LocalDateTime lastLoginTime;

	@ApiModelProperty(value = "项目ID")
	private String itemId;
	@ApiModelProperty(value = "项目名称")
	@TableField(exist = false)
	private String itemName;

	@TableField(exist = false)
	private String menus;

	@ApiModelProperty(value = "施工单位ID")
	private String constructionUnitId;


	@ApiModelProperty(value = "职位")
	private String position;


	@ApiModelProperty(value = "微信openId")
	private String openId;

	@ApiModelProperty(value = "是否需要订阅服务")
	private String needService;

	@ApiModelProperty(value = "微信用户union_id")
	private String unionId;

	@ApiModelProperty(value = "用户识别码")
	private String userIdentifNum;

	@ApiModelProperty(value = "被邀请码")
	private String invitedNum;


	/** 用户昵称 */
	@ApiModelProperty(value = "用户名称")
	private String nickName;

	/** 用户头像 */
	private String avatar;

	/** 工长用户类型 */
	@ApiModelProperty(value = "工长用户类型  1： 工长 ；2：散户")
	private String foremanType;


	@ApiModelProperty(value = "审核状态 1: 审核中、2: 审核通过、3: 审核拒绝")
	private String auditStatus;

	@ApiModelProperty("散户审核拒绝备注")
	private String remark;

	@ApiModelProperty("是否从平台下单")
	private String ifOnPlatform;

	@ApiModelProperty(value = "搅拌站额度")
	private String quota;

	@ApiModelProperty(value = "所属公司ID")
	private String ownCompanyId;

	@ApiModelProperty(value = "所属公司名称")
	private String ownCompanyName;



	@ApiModelProperty(value = "查询参数 姓名或者手机号")
	@TableField(exist = false)
	String queryParam;






	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;

		HsmwUser hsmwUser = (HsmwUser) o;

		if (flag != hsmwUser.flag) return false;
		if (username != null ? !username.equals(hsmwUser.username) : hsmwUser.username != null) return false;
		if (password != null ? !password.equals(hsmwUser.password) : hsmwUser.password != null) return false;
		if (name != null ? !name.equals(hsmwUser.name) : hsmwUser.name != null) return false;
		if (type != null ? !type.equals(hsmwUser.type) : hsmwUser.type != null) return false;
		if (roleId != null ? !roleId.equals(hsmwUser.roleId) : hsmwUser.roleId != null) return false;
		if (roleName != null ? !roleName.equals(hsmwUser.roleName) : hsmwUser.roleName != null) return false;
		if (enabled != null ? !enabled.equals(hsmwUser.enabled) : hsmwUser.enabled != null) return false;
		if (lastLoginTime != null ? !lastLoginTime.equals(hsmwUser.lastLoginTime) : hsmwUser.lastLoginTime != null)
			return false;
		if (itemId != null ? !itemId.equals(hsmwUser.itemId) : hsmwUser.itemId != null) return false;
		if (itemName != null ? !itemName.equals(hsmwUser.itemName) : hsmwUser.itemName != null) return false;
		if (menus != null ? !menus.equals(hsmwUser.menus) : hsmwUser.menus != null) return false;
		if (constructionUnitId != null ? !constructionUnitId.equals(hsmwUser.constructionUnitId) : hsmwUser.constructionUnitId != null)
			return false;
		return position != null ? position.equals(hsmwUser.position) : hsmwUser.position == null;
	}

	@Override
	public int hashCode() {
		int result = username != null ? username.hashCode() : 0;
		result = 31 * result + (password != null ? password.hashCode() : 0);
		result = 31 * result + (name != null ? name.hashCode() : 0);
		result = 31 * result + (type != null ? type.hashCode() : 0);
		result = 31 * result + (roleId != null ? roleId.hashCode() : 0);
		result = 31 * result + (roleName != null ? roleName.hashCode() : 0);
		result = 31 * result + (enabled != null ? enabled.hashCode() : 0);
		result = 31 * result + (flag ? 1 : 0);
		result = 31 * result + (lastLoginTime != null ? lastLoginTime.hashCode() : 0);
		result = 31 * result + (itemId != null ? itemId.hashCode() : 0);
		result = 31 * result + (itemName != null ? itemName.hashCode() : 0);
		result = 31 * result + (menus != null ? menus.hashCode() : 0);
		result = 31 * result + (constructionUnitId != null ? constructionUnitId.hashCode() : 0);
		result = 31 * result + (position != null ? position.hashCode() : 0);
		return result;
	}
}
